FROM node:12
ENV TZ="Asia/Shanghai"
COPY . /yapi/vendors
COPY ./config_example.json /yapi/config.json
RUN cd /yapi/vendors \
    && chmod +x /yapi/vendors/init.sh \
    && /yapi/vendors/init.sh \
    && apt-get update -y \
    && apt-get install -y wget make python gcc g++\
    && npm set strict-ssl false \
    && npm install -g yapi-cli ykit --registry https://registry.npm.taobao.org \
    && npm install --production --registry https://registry.npm.taobao.org \
    && cd /yapi \
    && yapi plugin --name yapi-plugin-add-user \
    && yapi plugin --name yapi-plugin-gitlab \
    && cp -r /yapi/node_modules/* /yapi/vendors/node_modules \
    && cp -r /yapi/node_modules/* /yapi/vendors/exts
WORKDIR /yapi/vendors
EXPOSE 3000
ENTRYPOINT ["node"]